import Vue from 'vue'
import Router, {createRouter, createWebHashHistory} from 'vue-router';
import Home from '@/pages/home/Home'
import City from '@/pages/city/City'
import Detail from '@/pages/detail/Detail'
import Article from "@/pages/article/Article";
import User from "@/pages/User/User";
import Login from "@/pages/User/Login";
import UserInfo from "@/pages/User/UserInfo";
import Register from "@/pages/User/Register";
import hotView from "@/pages/pendings/HotView";
import goodView from "@/pages/pendings/GoodView";
import guide from "@/pages/pendings/Guide";
import punch from "@/pages/pendings/Punch";
import shopping from "@/pages/pendings/Shopping";
import food from "@/pages/pendings/Food";
import car from "@/pages/pendings/Car";
import write from "@/pages/article/Write";
import Edit from "@/pages/article/Edit";

export default createRouter({
    history: createWebHashHistory(),

    routes: [{
        path: '/',
        name: 'Home',
        component: Home
    }, {
        path: '/city',
        name: 'City',
        component: City
    }, {
        path: '/detail/:id',
        name: 'Detail',
        component: Detail
    }, {
        path: '/article/:articleId',
        name: 'Article',
        component: Article
    }, {
        path: '/user/:id',
        name: 'User',
        component: User
    }, {
        path: '/login',
        name: 'Login',
        component: Login
    }, {
        path: '/userinfo/:id',
        name: 'Userinfo',
        component: UserInfo
    }, {
        path: '/register',
        name: 'Register',
        component: Register
    }, {
        path: '/hotview',
        name: 'Hotview',
        component: hotView
    }, {
        path: '/goodview',
        name: 'goodview',
        component: goodView
    }, {
        path: '/guide',
        name: 'guide',
        component: guide
    }, {
        path: '/punch',
        name: 'punch',
        component: punch
    }, {
        path: '/shoppping',
        name: 'shoppping',
        component: shopping
    }, {
        path: '/food',
        name: 'food',
        component: food
    }, {
        path: '/car',
        name: 'car',
        component: car
    }, {
        path: '/write/',
        name: 'write',
        component: write
    }, {
        path: '/edit/:id',
        name: 'Edit',
        component: Edit
    }
    ],

    scrollBehavior(to, from, savedPosition) {
        return {left: 0, top: 0}
    }
});
